package br.com.estrategos.configuracoes;

import java.util.ResourceBundle;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class ApplicationResource{

	private FacesMessage msg;

    public void addSucessMsg(String page, String info) {
        FacesContext context = FacesContext.getCurrentInstance();
        ResourceBundle bundle = context.getApplication().getResourceBundle(context, "bundle");
        info = bundle.getString(info);
        msg = new FacesMessage(FacesMessage.SEVERITY_INFO, info, info);
        FacesContext.getCurrentInstance().addMessage(page, msg);
    }

    public void addErrorMsg(String page, String info) {
        FacesContext context = FacesContext.getCurrentInstance();
        ResourceBundle bundle = context.getApplication().getResourceBundle(context, "bundle");
        info = bundle.getString(info);
        msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, info, info);
        FacesContext.getCurrentInstance().addMessage(page, msg);
    }

}